package com.pajk.user.service.login.sms;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @author haomin
 */
public class PhoneNumberUtil {

    public static Long  convert(String phoneNumber){
        // TODO add regex filtering
        return Long.valueOf(phoneNumber);
    }
    
    public static boolean isMobileNumber(String mobile){
    	if(mobile == null) return false;
		Pattern p = Pattern.compile("^1\\d{10}$");
		Matcher m = p.matcher(mobile);
		if(m.matches()) {
            return true;
		}
		return false;
	}

    public static boolean isSupportNumber(String mobile) {
        if(isMobileNumber(mobile)) {
            String head = mobile.substring(0, 3);
            //phone number does not support
            if("147".equals(head) || "177".equals(head) || "178".equals(head)
                    || "170".equals(head)) {
                return false;
            }
            return true;
        }
        return false;
    }
}
